<template>
  <div>
    <el-card class="main_card">
      <el-row>
        <el-col :span="8">
          <el-input placeholder="请输入日期" clearable v-model="queryInfo.queryString" @clear="findPage">
            <el-button slot="append" icon="el-icon-search" @click="findPage" />
          </el-input>
        </el-col>
        <el-col :span="2">
          <el-button style="margin-left: 10px"   v-hasPermi="['PRE_INSERT']" type="primary">最近一个月微信步数 请登录微信小程序更新数据</el-button>
        </el-col>
      </el-row>
      <el-table :data="tableList"
                stripe v-loading="loading"
                element-loading-text="玩命加载中"
                element-loading-spinner="el-icon-loading">
        <el-table-column type="index" label="序号" />
        <el-table-column prop="openid" label="微信openid" />
        <el-table-column prop="time" label="时间"/>
        <el-table-column prop="step" label="微信步数"/>
      </el-table>
      <el-pagination
        v-if="total>0"
        @size-change="handlePageSize"
        @current-change="handlePageNumber"
        :current-page="queryInfo.pageNumber"
        :page-sizes="[12, 15, 50, 100]"
        :page-size="queryInfo.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"/>

    </el-card>
    </div>
</template>
<script>
    export  default {
        data(){
            return{
                //分页查询条件
                queryInfo:{
                    //页码
                    pageNumber:1,
                    //页数
                    pageSize:12,
                    //关键字
                    queryString:null
                },
                //表格数据
                tableList:[],
                //总记录数
                total:0,
                //表单的标题
                title:null,
                //是否打开对话框
                open:false,
                //加载
                loading:false,
                //表单数据
                form:{},
                //表单校验
                rules:{
                    low:[
                        { required: true, message: '请输入舒张压（mmHG）', trigger: 'blur' },
                    ],
                    high:[
                        {required: true, message: '请输入收缩压（mmHG）', trigger: 'blur'},
                    ],
                    people:[
                        {required: true, message: '请输入体检者（mmHG）', trigger: 'blur'},
                        {min: 1, max:5 ,message:'请输入正常姓名',trigger: 'blur' }

                    ],
                }
            }
        },
        /*页面初始化调用方法*/
        created() {
            this.findPage();
        },
        methods:{
            findPage(){
                this.loading=true;
                this.$ajax.post('/sport/weixin/step',this.queryInfo).then((res)=>{
                    this.loading=false;
                    this.tableList=res.data.data.rows;
                    console.log(res.data.data,"1")
                    this.total=res.data.data.total;
                });
            },
            /*页码改变事件*/
            handlePageNumber(newPageNumber){
                //将分页的新数据赋值给分页参数
                this.queryInfo.pageNumber=newPageNumber;
                //调分页的方法
                this.findPage();
            },
            /*页数改变的事件*/
            handlePageSize(newPageSize){
                this.queryInfo.pageSize=newPageSize;
                this.findPage();

            },
        }

    }
</script>
<style scoped>

</style>
